#include <kuai/sim/energy.hpp>

#ifndef _KUAI_SIM_CONTROL_HPP_
#define _KUAI_SIM_CONTROL_HPP_

namespace kuai {
	class SimulationControl {
	public:
		SimulationControl() 
		{ 
			period = 1;
		}
		virtual ~SimulationControl()
		{ }

		virtual void act(SimulationEnvironment& env, EnergySet& eset, size_t istep) = 0;

		virtual void start(SimulationEnvironment& env, EnergySet& eset)
		{ }
		virtual void finish(SimulationEnvironment& env, EnergySet& eset, size_t nstep)
		{ }
		virtual void finalize(SimulationEnvironment& env, EnergySet& eset)
		{ }

		size_t period;
	};

	class ControlSet {
	public:
		void start(SimulationEnvironment& env, EnergySet& eset);
		void finish(SimulationEnvironment& env, EnergySet& eset, size_t nstep);
		void finalize(SimulationEnvironment& env, EnergySet& eset);
		void act(SimulationEnvironment& env, EnergySet& eset, size_t istep);

		std::vector<SimulationControl*> funcs;

	private:
		std::vector<size_t> next_x;
	};

}

#endif
